<?php

class CacheManager
{
    public static function getCacheKey(array $keys)
    {
	if (empty($keys)) {
	    throw new Exception("Memcache keys list is empty");
	}
	return md5(implode('.', array_values($keys)));
	//return implode('.', array_values($keys));
    }

    public static function getCache($name = 'cache')
    {
	if (!isset(Yii::app()->$name) || (Yii::app()->$name instanceof CCache) === false) {
	    throw new Exception("Cache name is not defined. Please init in config");
	}
	return Yii::app()->$name;
    }

}